''========================================================
'' Autor: 		Luis Antonio Lara Capetillo
'' Fecha Creación: 	31/5/2013
'' Descripcion: 	Clase Componente ctlTrabajo_Preguntas
''========================================================

Public Class ctlTrabajo_Preguntas

  Inherits System.Web.UI.UserControl
#Region "Propiedades"
  

  ''' <summary>
  ''' Habilita o Desabilita el Control para Edicion
  ''' </summary>
  ''' <value>True o False</value>
  ''' <remarks></remarks>
  Public WriteOnly Property Enabled() As Boolean
    Set(value As Boolean)
	  gdvNid.Enabled=value
      
    End Set
  End Property

  ''' <summary>
  ''' Habilita o Desabilita el Control para solo lectura
  ''' </summary>
  ''' <value>True o False</value>
  ''' <remarks>ReadOnly</remarks>
  Public WriteOnly Property Lectura() As Boolean
    Set(value As Boolean)
	  gdvNid.ReadOnly=value
      
    End Set
  End Property


#End Region
#Region "Eventos"
    Protected Sub gdvNid_RowCommand(sender As Object, e As System.Web.UI.WebControls.GridViewCommandEventArgs)
        Dim index As Integer
        index = Convert.ToInt32(e.CommandArgument)
        If e.CommandName = "Seleccionar" Then
            If CType(gdvNid.Rows(index).Cells(3).FindControl("chxSelecionar"), CheckBox).Checked Then
                CType(gdvNid.Rows(index).Cells(3).FindControl("chxSelecionar"), CheckBox).Checked = False
            Else
                CType(gdvNid.Rows(index).Cells(3).FindControl("chxSelecionar"), CheckBox).Checked = True
            End If
        End If
    End Sub
  
    Protected Sub gdvNid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gdvNid.RowDataBound
        Try
            e.Row.Cells(0).Visible = False
            e.Row.Cells(2).Visible = False
        Catch ex As Exception

        End Try
    End Sub

#End Region
#Region "Metodos"
  

  ''' <summary>
  ''' Metodo para asignar los datos al componente 
  ''' </summary>
  ''' <param name="tablaDatos">DataTable donde se obtienen los datos</param>
  ''' <remarks></remarks>
  Public Sub AsignarDatos(ByVal tablaDatos As DataTable)
    
  End Sub


    ''' <summary>
    ''' Funcion para verificar los datos del control
    ''' </summary>
    ''' <returns>str_Mensaje</returns>
    ''' <remarks>si hay datos no validos regresara un mensaje de lo contrario ""</remarks>
    Public Function VerificarDatos() As String
        Dim validar As New ValidacionCampo
        Dim str_Mensaje = ""
		
		str_Mensaje += validar.ValidaCampo(gdvNid, "Nid")
    
		
        Return str_Mensaje
    End Function

#End Region
End Class
